package com.db.stockexchange.common.messages.client;

import com.db.stockexchange.common.OrderSide;
import com.db.stockexchange.common.OrderType;
import com.db.stockexchange.common.messages.MessageType;

public class NewOrderMessage extends ClientOrderMessage {
	private int orderQuantity;
	private OrderType orderType;
	private float price;
	
	public int getOrderQuantity() {
		return orderQuantity;
	}
	public OrderType getOrderType() {
		return orderType;
	}
	public float getPrice() {
		return price;
	}
	
	public NewOrderMessage(String senderCompID, int orderID,
			String symbol, OrderSide side, int orderQuantity,
			OrderType orderType, float price) {
		super(MessageType.NEW_ORDER, senderCompID, orderID, symbol, side);
		this.orderQuantity = orderQuantity;
		this.orderType = orderType;
		this.price = price;
	}		
	
	@Override
	public String toString() {
		return new StringBuilder().append(super.toString())
				.append(", ").append(orderQuantity).append("@")
				.append(orderType == OrderType.MARKET ? orderType : price).toString();
	}
}
